<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title> - 亲友圈管理</title>
	    <meta name="keywords" content="">
	    <meta name="description" content="">
	    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	    <link href="__STATIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	    <link href="__STATIC__/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	    <link href="__STATIC__/css/animate.css" rel="stylesheet">
	    <link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	    <link href="__STATIC__/css/new_file.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="__STATIC__/css/information.css" />
	</head>
	<body class="gray-bg">
		<div class="wrapper wrapper-content  animated fadeInRight">
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox ">
						<div class="ibox-title">
							<h5>亲友圈管理</h5>
						</div>
						<div class="toogl_body">
	                    	<a href="Club.html"><button type="button" class="btn btn-w-m btn-bt btn-info">亲友圈管理</button></a>
							<a href="Club_configure.html"><button type="button" class="btn btn-w-m btn-white btn-bt">蓝钻商城配置</button></a>
							<a href="Club_goldcoin.html"><button type="button" class="btn btn-w-m btn-white btn-bt">黄钻商城配置</button></a>
							<a href="Club_vipcard.html"><button type="button" class="btn btn-w-m btn-white btn-bt">会员卡商城配置</button></a>
	                    	<a href="Club_establish.html"><button type="button" class="btn btn-w-m btn-white btn-bt">创建亲友圈</button></a>

	                    	<!--<a href="Club_grant.html"><button type="button" class="btn btn-w-m btn-white btn-bt">金币发放</button></a>-->
	                    	<a href="Club_conf.html"><button type="button" class="btn btn-w-m btn-white btn-bt">亲友圈配置</button></a>
	                    	<hr style="clear: both;"/>
	                    	<a href="Club.html"><button type="button" class="btn btn-w-m btn-white">分成模式</button></a>
							<a href="Club.html"><button type="button" class="btn btn-w-m btn-info">免费模式</button></a>
	                    	<a href="Club_1.html"><button type="button" class="btn btn-w-m btn-white">操作记录</button></a>
							<div class="ibox-content ibox-jqGrid">
								<div class="form-group mmp-gbl"><br/>
	                                <label class="col-sm-2 control-dy">创建日期：</label>
	                                <div class="col-sm-8 form-time1">
	                                    <input type="text" placeholder="请输入创建日期" class="form-control form-time-bk" id="time1" readonly="readonly"> 
	                                </div>
	                                <label class="col-sm-2 control-dy">会长ID：</label>
	                                <div class="col-sm-8 form-time1">
	                                    <input type="text" placeholder="请输入会长ID" class="form-control form-time-bk" id="president_id"> 
	                                </div>
	                                <label class="col-sm-2 control-dy">亲友圈ID：</label>
	                                <div class="col-sm-8 form-time1">
	                                    <input type="text" placeholder="请输入亲友圈ID" class="form-control form-time-bk" id="club_id">
	                                </div>
	                                <label class="col-sm-2 control-dy">亲友圈名称：</label>
	                                <div class="col-sm-8 form-time1">
	                                    <input type="text" placeholder="请输入亲友圈名称" class="form-control form-time-bk" id="club_name">
	                                </div>
									<label class="col-sm-2 control-dy">所属区域：</label>
									<div class="col-sm-8 form-time1">
										<select class="form-control form-consele" id="area">
										{if ($auth == '管理员') }
										   <option value="0">全部</option>
										{else /}
											<option value="">请选择所属区域</option>
										{/if}
										</select>
									</div>
	                                <label class="col-sm-2 control-dy">当前状态：</label>
	                                <div class="col-sm-8 form-time1">
	                                    <select class="form-control form-consele" id="club_status">
										   <option value="2">请选择状态</option>
										   <option value="0">解散</option>
										   <option value="1">正常</option>
										</select>
	                                </div>
	                                <button type="button" class="btn btn-w-m btn-info" id="buttonid">查询</button>
	                            </div>
		                        <div class="jqGrid_wrapper">
		                            <table id="table_list_1"></table>
		                            <div id="pager_list_1"></div>
		                        </div>
		                    </div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 人数   -->
		<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border">
								<div class="ibox-content">
									<form class="form-horizontal">
										<div class="gam_bg">
											<div class="gam_bgnrt7">
												<span>成员昵称</span>
											</div>
											<div class="gam_bgnrt7">
												<span>成员ID</span>
											</div>
											<div class="gam_bgnrt7">
												<span>加入时间</span>
											</div>
											<div class="gam_bgnrt7">
												<span>会员卡种类</span>
											</div>
											<div class="gam_bgnrt7">
												<span>会员卡截止时间</span>
											</div>
										</div>
										<div id="pepole">
										<!-- <div class="gam_bg">
											<div class="gam_bgnrt2">
												<span>亲友圈名称</span>
											</div>
											<div class="gam_bgnrt2">
												<span>金币数量</span>
											</div>
											<div class="gam_bgnrt2">
												<span>金币数量</span>
											</div>
										</div> -->
										</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--人数end-->
		<!-- 修改   -->
		<div id="myModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border">
								<div class="ibox-content">
									<form class="form-horizontal">
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">亲友圈昵称：</label>
			                                <div class="col-sm-8">
			                                
			                                     <input type="hidden" value="" class="form-control" id="modify_club_id">
			                                     <input type="text" value="" class="form-control" id="modify_club_name">
			                                     <input type="hidden" value="" class="form-control" id="old_modify_club_name">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">用户昵称：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="modify_president_name" readonly="readonly">
			                                    <input type="hidden" value="" class="form-control" id="old_modify_president_name" readonly="readonly">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">更换会长：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="modify_president_id">
			                                </div>
			                            </div>
			                            <!--<div class="form-group">-->
			                                <!--<label class="col-sm-2 control-label">亲友圈钻石数：</label>-->
			                                <!--<div class="col-sm-8">-->
			                                    <!--<input type="text" value="" class="form-control" id="modify_club_diamond">-->
			                                    <!--<input type="hidden" value="" class="form-control" id="old_modify_club_diamond">-->
			                                <!--</div>-->
			                            <!--</div>-->
			                            <!--<div class="form-group">-->
			                                <!--<label class="col-sm-2 control-label">亲友圈金币数：</label>-->
			                                <!--<div class="col-sm-8">-->
			                                    <!--<input type="text" value="" class="form-control" id="modify_club_gold">-->
			                                    <!--<input type="hidden" value="" class="form-control" id="old_modify_club_gold">-->
			                                <!--</div>-->
			                            <!--</div>-->
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">亲友圈人数上限：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="modify_club_members_count">
			                                    <input type="hidden" value="" class="form-control" id="old_modify_club_members_count">
			                                </div>
			                            </div>
		                                <div class="form-group regiondiv">
											<input type="hidden" id="play_id">
		                                    <input type="button" value="玩法配置" class="btn btn-info" onclick="region()">　
		                                </div>
										<label class="col-sm-2 control-dy " style='width:88px'>房费配置项：</label>
										<div class="col-sm-8 form-time1">
											<select  id="room_rate" class="form-control">
												<option value="0">均摊模式</option>
												<option value="1">大赢家模式</option>
											</select>　
										</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="Club_modify()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--修改 end-->
		
				
		<!-- 弹出  详情   -->
		<div class="region">
			<div id="gray_Nr">
				<div class="col-sm-4 acco-tc">
					<div class="ibox float-e-margins float-e-margins-xiao">
						<div class="ibox-title">
							<h5>选择区域</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times" onclick="regionrom()"></i>
								</a>
							</div>
						</div>
						<div class="province_bod">
							<div class="province_1" id="game" style="width: 100%">
								<p class="province_top">选择区域</p>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m " type="button" id="all" style="background-color:#B4CDCD" value="全选">
							<input class="btn btn-w-m " type="button" id="Uall" style="background-color:#A9A9A9" value="取消全选">
							<input class="btn btn-w-m btn-info" type="button" id="button_ban_user" data-dismiss="modal" value="确定"  onclick="regionqud()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" id="cancel" value="取消"  onclick="regionrom()">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--弹出end  详情-->
		<!-- 冻结   -->
		<div id="myModal3" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border">
								<div class="ibox-content">
									<form class="form-horizontal">
										<input type="hidden" name="" id="Club_dissolution_id">
										<input type="hidden" name="" id="Club_dissolution_name">
			                            <div class="form-texcan">解散亲友圈无法恢复</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="Club_dissolution()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
<!--手机导航-->
<div class="to-fdh" style="display: none;">
	<img class="to-imgd" src="__STATIC__/img/phonedh.jpg">
	<div class="mob-nrlb">
		<ul>
			<li>
				<a class="mob-nrdh">管理</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('Player/gameplayer')}">玩家管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('system/notice')}">公告管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('email/mail')}">邮件管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Club/club')}">亲友圈管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Money/money')}">提现管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Order/order')}">订单管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">数据</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('data/datagk')}">概況</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datawf')}">玩法</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datalc')}">留存</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datass')}">实时数据</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataczfx')}">充值分析</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataclub')}">亲友圈统计</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/president')}">高级会长</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/regionaldata')}">地区数据</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh mob-qbh">权限</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_list')}">权限管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_group')}">用户组管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('account/account_details')}">后台账号管理</a>
					</li>
				</ul>
			</li>
		</ul>
	</div>
</div>
<div id="zkbg">
	<img src="__STATIC__/img/dp.gif">
</div>
<div class="vnl-zz" style="display:none">
	<div><img src="__STATIC__/img/bqhp.gif"></div>
</div>
<!--手机适配-->
		<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
		<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
		<script src="__STATIC__/js/plugins/peity/jquery.peity.min.js"></script>
		<script src="__STATIC__/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
		<script src="__STATIC__/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
		<script src="__STATIC__/js/content.js?v=1.0.0"></script>
		<script src="__STATIC__/js/plugins/laydate/laydate.js"></script>
		<script src="__STATIC__/js/echarts.min.js"></script>
		<script src="__STATIC__/js/echarts.common.min.js"></script>
		<script>
            function region(){
                $('.region').show();
            }
            function regionrom(){
                $('.region').hide();
            }
            function regionqud(){
                $('.region').hide();
            }
            //手机适配
            $(function(){
                if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                    $("head").append("<link>");
                    var css = $("head").children(":last");
                    css.attr({
                        rel:  "stylesheet",
                        type: "text/css",
                        href: "__STATIC__/css/phone_sp.css"
                    });
                    var mql = window.matchMedia("(orientation: portrait)");
                    if(mql.matches) { //竖屏样式
                        $(".vnl-zz").show();
                        $(".to-fdh").hide();
                    }else{
                        $(".to-fdh").show();
                        $("html").width("100%");
                        $("body").width("100%");
                    }
                    mql.addListener(function(m) {
                        if(m.matches) {
                            // 改变到直立方向
                            $(".vnl-zz").show();
                            $(".to-fdh").hide();
                        }
                        else {
                            $(".to-fdh").show();
                            $(".vnl-zz").hide();
                            $("html").width("100%");
                            $("body").width("100%");
                        }
                    });
                }
            });
            //导航显示展开
            $(".mob-nrdh").click(function(){
                $(this).next().toggle(".mob-nryc");
            });
            $(".to-imgd").click(function(){
                $(this).next().toggle(".mob-nrlb");
            });
            //手机适配end
		 function _getMessage(t) {
              $('input:checkbox').prop('checked', false);
				var id = $(t).parent().parent().children().eq(1).html();//亲友圈id
				var club_name = $(t).parent().parent().children().eq(0).html();//亲友圈名称
				var president_name = $(t).parent().parent().children().eq(3).html();//亲友圈会长名
				var president_id = $(t).parent().parent().children().eq(4).html();//亲友圈会id
				var club_diamond = $(t).parent().parent().children().eq(5).html();//亲友圈会钻石数
				var club_gold = $(t).parent().parent().children().eq(6).html();//亲友圈会金币数
				var modify_club_members_count = $(t).parent().parent().children().eq(7).html();//亲友圈会金币数
             	var play_id = $(t).parent().parent().children().eq(10).html();//返利
				var room_rate = $(t).parent().parent().children().eq(11).html();//返利
				 // if(room_rate == 0){
				 var room_rate= $('#room_rate').val(room_rate);
				 room_rate.attr("selected", "selected");


				$('#Club_dissolution_id').val(id);//亲友圈解散id
				$('#Club_dissolution_name').val(club_name);//亲友圈解散id
				$('#modify_club_id').val(id);//修改亲友圈id
				$('#modify_club_name').val(club_name);//修改亲友圈名
				$('#modify_president_name').val(president_name);//修改亲友圈会长名
				$('#modify_president_id').val(president_id);//修改亲友圈会长id
				$('#modify_club_diamond').val(club_diamond);//修改亲友圈钻石
				$('#modify_club_gold').val(club_gold);//修改亲友圈金币数
				$('#modify_club_members_count').val(modify_club_members_count);//修改亲友圈上限人数
             	$('#play_id').val(play_id);//修改亲友圈上限人数


				$('#old_modify_club_id').val(id);//修改亲友圈id
				$('#old_modify_club_name').val(club_name);//修改亲友圈名
				$('#old_modify_president_name').val(president_name);//修改亲友圈会长名
				$('#old_modify_president_id').val(president_id);//修改亲友圈会长id
				$('#old_modify_club_diamond').val(club_diamond);//修改亲友圈钻石
				$('#old_modify_club_gold').val(club_gold);//修改亲友圈金币数
				$('#old_modify_club_members_count').val(modify_club_members_count);//修改亲友圈上限人数

		}
         //玩家所属亲友圈
         $(function() {
             $.ajax({
                 type: "post",
                 url: "{:url('account/Area')}",
                 data: {},
                 dataType: "json",
                 success: function(e) {
                     console.log(e);
                     for(i in e) {
                         $("#area").append("<option value='" + e[i].aid + "'>" + e[i].area_name + "</option>");
                     }
                 },
                 error: function(e) {
                     console.log(e);
                 }
             });
         });
            //游戏
            $(function() {
                $.ajax({
                    type: "post",
                    url: "{:url('account/Owngame')}",
                    data: {},
                    dataType: "json",
                    success: function(e) {
                        console.log(e);
                        for(i in e) {
                            $("#game").append( "<p class='province_nr pre_n1'><span>"+e[i].name+"</span><input type='checkbox' class='fa province_jt bxd_chox play' name='game' value='"+e[i].id+"'></p>");

                        }
                    },
                    error: function(e) {
                        console.log(e);
                    }
                });
            });
            /*选择游戏*/
            $("#button_ban_user").click(function() {
                var arr = new Array();
                $("input[type=checkbox].play").each(function() {
                    if($(this).prop("checked") == true){
                        // console.log($(this).val());
                        arr.push($(this).val());
                    }
                });
                console.log(arr);
            });
            $("#all").click(function() {
                $("input[type=checkbox].play").each(function() {
                    // if(this.checked == true){
                    //     $(this).prop('checked', false);
                    // }else{
                    $(this).prop('checked', true);
                    // }

                });

            });
            $("#Uall").click(function() {
                $("input[type=checkbox].play").each(function() {
                    $(this).prop('checked', false);

                });

            });
            $("#cancel").click(function() {
                $("input[type=checkbox].play").each(function () {
                    $(this).attr('checked',false);
                });
            });
            $("#form_games").click(function() {
                var game =  $("#play_id").val();
                var game = game.split(",");
                // console.log(game);
                $("input[type=checkbox].play").each(function() {
                    for (i in game){
                        // console.log($(this).val() );
                        if($(this).val() == game[i]){
                            $(this).prop('checked', true);
                        }
                    }
                });
            });
		//根据会长id改变 改变会长名
		$("#modify_president_id").blur(function(){
			 var player_id = $('#modify_president_id').val();
			 $.ajax({
					type: "post",
					url: "__URL__/president_name",
					data: {
						'player_id':player_id,
					},
					dataType: "json",
					success: function(e) {
						$('#modify_president_name').val(e);//修改亲友圈会长名
						
					},
					error: function(e) {
						console.log(e);
						// alert(e.msg);
					}
				});
		});
		//解散亲友圈
		function Club_dissolution(){

				var id = $('#Club_dissolution_id').val();
				var name = $('#Club_dissolution_name').val();
				var new_date = "亲友圈昵称："+name+"，状态"+"正常";
		     	var old_date = "亲友圈昵称："+name+"，状态"+"解散";
			    $.ajax({
					type: "post",
					url: "__URL__/Club_dissolution",
					data: {
						'club_id':id,
						'club_name':name,
						'old_date':old_date,
						'new_date':new_date,
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
						location.reload();
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
		}
		//亲友圈修改
		function Club_modify(){
            var game = new Array();
            $("input[type=checkbox].play").each(function() {
                if($(this).prop("checked") == true){
                    game.push($(this).val());
                }
            });
				var Data ={
					//新数据
		     		club_id:$("#modify_club_id").val(),
					club_name:$("#modify_club_name").val(),
					president_id:$("#modify_president_id").val(),
					president_name:$("#modify_president_name").val(),
					max_club_members_count:$("#modify_club_members_count").val(),
					// club_diamond:$("#modify_club_diamond").val(),
					club_gold:$("#modify_club_gold").val(),
                    room_rate:$("#room_rate").val(),
					//原数据
					old_club_name:$("#old_modify_club_name").val(),
					old_president_name:$("#old_modify_president_name").val(),
					old_max_club_members_count:$("#old_modify_club_members_count").val(),
					// old_club_diamond:$("#old_modify_club_diamond").val(),
					old_club_gold:$("#old_modify_club_gold").val(),
		     	};
            var new_date = "亲友圈昵称："+Data.club_name+"，会长昵称："+Data.president_name+"，亲友圈最大人数"+Data.max_club_members_count;
            var old_date = "亲友圈昵称："+Data.old_club_name+"，会长昵称："+Data.old_president_name+"，亲友圈最大人数"+Data.old_max_club_members_count;
		     	// var new_date = "亲友圈昵称："+Data.club_name+"，会长昵称："+Data.president_name+"，亲友圈钻石数："+Data.club_diamond+"，亲友圈金币数："+Data.club_gold+"，亲友圈最大人数"+Data.max_club_members_count;
		     	// var old_date = "亲友圈昵称："+Data.old_club_name+"，会长昵称："+Data.old_president_name+"，亲友圈钻石数："+Data.old_club_diamond+"，亲友圈金币数："+Data.old_club_gold+"，亲友圈最大人数"+Data.old_max_club_members_count;
			    $.ajax({
					type: "post",
					url: "__URL__/Club_modify",
					data: {
						'club_id':Data.club_id,
						'club_name':Data.club_name,
						'president_id':Data.president_id,
						'president_name':Data.president_name,
						'max_club_members_count':Data.max_club_members_count,
						'club_gold':Data.club_gold,
						// 'club_diamond':Data.club_diamond,
						'old_date':old_date,
						'new_date':new_date,
                        'game':game,
                        'room_rate':Data.room_rate
					},
					dataType: "json",
					success: function(e) {
						console.log(e);
						alert(e.msg);
						location.reload();
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
		}
		//亲友圈成员（查询）
		function Club_query_pepole(t){
			$("#pepole").html("");
			var club_id = $(t).parent().parent().children().eq(1).html();//亲友圈id
			    $.ajax({
					type: "post",
					url: "__URL__/Club_query_pepole",
					data: {
						'club_id':club_id
					},
					dataType: "json",
					success: function(e) {
						console.log(e);
						for(i in e){
                            $("#pepole").append('<div class="gam_bg"><div class="gam_bgnrt8"><span>'+e[i].nickname+'</span></div><div class="gam_bgnrt8"><span>'+e[i].player_id+'</span></div><div class="gam_bgnrt8"><span>'+e[i].create_time+'</span></div><div class="gam_bgnrt8"><span>'+e[i].vip_name+'</span></div><div class="gam_bgnrt8"><span>'+e[i].end_day+'</span></div></div>');
						}
					},
					error: function(e) {
					}
				});
		}
		$('#buttonid').on('click', function() {     //页面上的button按钮的click事件，重新获取参数后发送参数，然后重新加载数据。
		     	var Data ={
		     		create_time:$("#time1").val(),
					club_id:$("#club_id").val(),
					club_name:$("#club_name").val(),
					club_status:$("#club_status").val(),
					president_id:$("#president_id").val(),
                    area_id:$("#area").val(),
		     	};
        		if(Data.area_id == ""){
                	alert("请选择所属地区");
                	return false;
                   }	
                $("#table_list_1").jqGrid('setGridParam',{
                	url:'__URL__/Club_query_free',
                    datatype:'json',
                    postData:{
                    'create_time':Data.create_time,
                    'president_id':Data.president_id,
                    'club_id':Data.club_id,
                    'club_name':Data.club_name,
                    'club_status':Data.club_status,
                    'area_id':Data.area_id
                	},
                    page:1
                }).trigger("reloadGrid"); //重新载入

        });

        $(document).ready(function () {

            $.jgrid.defaults.styleUI = 'Bootstrap';
     

            $("#table_list_1").jqGrid({
                // url:'__URL__/Club_query',
                datatype:'json',
                postData:{}, //发送数据
                mtype: 'POST',
                height: 450,
                autowidth: true,
                shrinkToFit: true,
                rowNum: 20,
                rowList: [20,50,100],
                colNames: ['亲友圈名称', '亲友圈ID', '创建时间', '会长昵称', '会长ID', '亲友圈人数','黄钻数','亲友圈最大','状态','所属区域','所属游戏','room_rate','操作'],
                colModel: [
                    {
                        name: 'club_name',
                        index: 'club_name',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'cid',
                        index: 'cid',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'create_time',
                        index: 'create_time',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'president_name',
                        index: 'president_name',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'president_id',
                        index: 'president_id',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'number_people',
                        index: 'number_people',
                        width: 60,
                        formatter: function(number_people) {
                            return '<input type="button" value="'+number_people+'" id="pe" data-toggle="modal" data-target="#myModal" class="btn btn-info" onclick="Club_query_pepole(this)"/>';
                            // return '<input type="button" value="club_status" id="pe" data-toggle="modal" data-target="#myModal" class="btn btn-info" onclick="re(this)"/>';
                        },
                        align:'center'
                    },
                    {
                        name: 'yellow_diamond',
                        index: 'yellow_diamond',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'max_club_members_count',
                        index: 'max_club_members_count',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center',
                        hidden :true,
                    },
                    {
                        name: 'club_status',
                        index: 'club_status',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center',
                        formatter: function(club_status) {
                            switch(Number(club_status)){
                                case 0:
                                    return '<span style="color:red">已解散</span>'
                                case 1:
                                    return '<span style="color:#00EE00">正常</span>'
                            }
                        },
                    },
                    {
                        name: 'area_name',
                        index: 'area_name',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'play_id',
                        index: 'play_id',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center',
                        hidden :true,
                    },
                    {
                        name: 'room_rate',
                        index: 'room_rate',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center',
                        hidden :true,
                    },

                    {
                        name: 'club_status',
                        index: 'club_status',
                        width: 60,
                        formatter: function(club_status) {
                            switch(Number(club_status)){
                                case 0:
                                    return '<span style="color:red">已解散</span>'
                                case 1:
                                    // return '';
                                    return '<input type="button" value="修改" id="" data-toggle="modal" data-target="#myModal2" class="btn btn-info" onclick="_getMessage(this)"/><input type="button" value="解散" id="" data-toggle="modal" data-target="#myModal3" class="btn btn-danger" onclick="_getMessage(this)"/>';
                            }

                        },
                        align:'center'
                    }
                ],
                pager: "#pager_list_1",
                loadonce: true,
                viewrecords: true,
                caption: "亲友圈管理",
                hidegrid: false
            });
            $("#jd").hide();
            $(function(){
            	$("#jd").click(function(){
            		$("#jd").hide();
            		$("#dj").show();
            	});
            	$("#dj").click(function(){
            		$("#dj").hide();
            		$("#jd").show();
            	});
            });
            $("#fj").hide();
            $(function(){
            	$("#fj").click(function(){
            		$("#fj").hide();
            		$("#jj").show();
            	});
            	$("#jj").click(function(){
            		$("#jj").hide();
            		$("#fj").show();
            	});
            });
            $('.form-conselein').hide();
			$('.form-consele').on('change',function(){
				if ($('.form-consele').val() == '0') {
					$('.form-conselein').hide();
				} else{
					$('.form-conselein').show();
				}
			})
            
			setTimeout(function(){
                var width = $('.jqGrid_wrapper').width();
                $('#table_list_1').setGridWidth(width);
			},500);
            
		    laydate.render({
		      elem: '#time1'
		    });
		    laydate.render({
		      elem: '#time2'
		      ,range: true
		    });
        });
    </script>


	</body>

</html>